import { request } from "@/utils/request";

export function Login(msg) {
    // 登录
    return request({
        url: '/user/login',
        method: "POST",
        data: msg
    })
}
export function Register(msg) {
    // 注册
    return request({
        url: '/user/register',
        method: "POST",
        data: msg
    })
}
export function OutLogin() {
    // 退出登录
    return request({
        url: '/user/outLogin',
        method: 'DELETE',
        headers: {
            'Authorization': window.localStorage.getItem('token')
        }
    })
}
export function CloseUser() {
    // 注销
    return request({
        url: '/user/closeUser',
        method: 'DELETE',
        headers: {
            'Authorization': window.localStorage.getItem('token')
        }
    })
}
export function GetUserNameAndImgHead() {
    // 得到用户名称和用户头像
    return request({
        url: '/userCard/getUserNameAndImgHeadByToken',
        method: 'POST',
        headers: {
            'Authorization': window.localStorage.getItem('token')
        }
    })
}

export function getNoteImgAndNoteTitle(msg) {
    //  根据用户得到笔记的默认封面和标题
    return request({
        url: '/noteCard/getNoteImgAndNoteTitle',
        method: 'POST',
        data: msg,
        headers: {
            'Authorization': window.localStorage.getItem('token')
        }
    })
}

